.TH "ggiSetDisplayFrame" 3 "2007-12-17" "libggi-current" GGI
.SH NAME
\fBggiSetDisplayFrame\fR, \fBggiSetWriteFrame\fR, \fBggiSetReadFrame\fR, \fBggiGetDisplayFrame\fR, \fBggiGetWriteFrame\fR, \fBggiGetReadFrame\fR : Set or get the current frame for display, writing and reading
.SH SYNOPSIS
.nb
.nf
#include <ggi/ggi.h>

int ggiSetDisplayFrame(ggi_visual_t vis, int frameno);

int ggiSetWriteFrame(ggi_visual_t vis, int frameno);

int ggiSetReadFrame(ggi_visual_t vis, int frameno);

int ggiGetDisplayFrame(ggi_visual_t vis);

int ggiGetWriteFrame(ggi_visual_t vis);

int ggiGetReadFrame(ggi_visual_t vis);
.fi

.SH DESCRIPTION
These functions are used for selecting or getting the current buffers,
when using the multiple buffering function of LibGGI.

\fBggiSetDisplayFrame\fR sets the frame that gets displayed.

\fBggiSetWriteFrame\fR sets the frame for write operations such as
\f(CWggiPuts(3)\fR and \f(CWggiPutHLine(3)\fR.

\fBggiSetReadFrame\fR sets the frame for read operations, like
\fBggiGetPixel(3)\fR and the \fBggiCrossBlit(3)\fR source.

\fBggiGetDisplayFrame\fR reports the frame currently displayed.

\fBggiGetWriteFrame\fR reports the frame currently written to.

\fBggiSetReadFrame\fR reports the frame currently read from.

Frames are numbered from 0 to the number of frames requested minus 1.
.SH RETURN VALUE
The \fBggiSet*Frame\fR functions return \fB0\fR if they succeed, and an
\f(CWgg-error(3)\fR on failure.

The \fBggiGet*Frame\fR functions never fail.
.SH WORKING WITH FRAMES
People report about heavy flickering, they can't solve.

This is because they display the frame \fIduring\fR rendering.
Unless you know what you do, never set the same frame to write
and display mode.

Wrong (causes flickering):

.nb
.nf
ggiSetWriteFrame(vis, framenr);
ggiSetDisplayFrame(vis, framenr);

/* render here */
.fi

Right:

.nb
.nf
ggiSetWriteFrame(vis, framenr);

/* render here */

ggiSetDisplayFrame(vis, framenr);
.fi

.SH SEE ALSO
\f(CWggi_mode(3)\fR
